<%@ include file="/common/taglibs.jsp" %>

<head>
    <title><fmt:message key="issueDetail.title"/></title>
    <meta content="<fmt:message key='issueDetail.heading'/>"/>
</head>

<s:form id="issueForm" action="saveIssue" method="post" validate="true">
    <s:hidden name="issue.id" value="%{issue.id}"/>

    <s:textfield key="issue.project" required="true" cssClass="text medium"/>
    <s:textfield key="issue.description" required="true" cssClass="text medium"/>
    <s:textfield key="issue.type" required="true" cssClass="text medium"/>
    <s:textfield key="issue.severity" required="true" cssClass="text medium"/>
    <s:textfield key="issue.status" required="true" cssClass="text medium"/>
    <s:textarea key="issue.details" required="true" cssClass="text medium"/>

    <li class="buttonBar bottom">
        <s:submit cssClass="button" method="save" key="button.save" theme="simple"/>
        <c:if test="${not empty issue.id}">
            <s:submit cssClass="button" method="delete" key="button.delete" onclick="return confirmDelete('issue')" theme="simple"/>
        </c:if>
        <s:submit cssClass="button" method="cancel" key="button.cancel" theme="simple"/>
    </li>

</s:form>



<c:if test="${not empty issue.id}">

    <s:form id="commentsForm" action="editComment" method="post" validate="true">

        <s:set name="comments" value="comments" scope="request"/>
        <s:hidden name="issue.id" value="%{issue.id}"/>

        <display:table name="comments" class="table" requestURI="" id="commentList" export="false" pagesize="25">
            <display:column property="id" sortable="true" href="editComment.html"
                            paramId="id" paramProperty="id" titleKey="comment.id"/>
            <display:column property="author" sortable="true" titleKey="comment.author"/>
            <display:column property="commentText" sortable="false" titleKey="comment.commentText"/>

            <display:setProperty name="paging.banner.item_name" value="comment"/>
            <display:setProperty name="paging.banner.items_name" value="comments"/>

        </display:table>

        <s:submit cssClass="button" key="button.add" theme="simple"/>

    </s:form>

</c:if>

<script type="text/javascript">
    highlightTableRows("commentList");
</script>

<script type="text/javascript">
    Form.focusFirstElement($("issueForm"));
</script>